package com.ys.web.user.info;

import com.ys.base.BaseDao;
import com.ys.web.user.login.LoginInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface UserInfoMapper extends BaseDao {
    @Update("update user_wx set nickName=#{nickName} where id=#{id}")
    int updateUserNickName(UserInfo info);

    @Update("update user_wx set avatarUrl=#{avatarUrl} where id=#{id}")
    int updateUserAvatarUrl(UserInfo info);

    @Update("update user_wx set phone=#{phone} where id=#{id}")
    int updateUserPhone(UserInfo info);

    List<UserInfo> getUserInfoByIds(List<Long> list);

    @Select("select id from user_wx where realIdCard=#{realIdCard}")
    Integer getOpenAccountCountByCardNo(String realIdCard);
    @Select("select uid from user_id_card_mobao where realIdCard=#{realIdCard}")
    Long getOpenAccountCountMbCardNo(String realIdCard);
    @Update("update user_wx set realName=#{realName},realIdCard=#{realIdCard},phone=#{phone} where id=#{id}")
    int updateRealByUser(LoginInfo loginInfo);

    @Select("select id,nickName,avatarUrl,phone from user_wx where id=#{id}")
    UserInfo getUserInfoById(Long id);

    @Select("select * from user_wx where id=#{id}")
    LoginInfo getUserInfo(Long id);
    @Select("select id from user_wx where phone=#{phone}")
    Integer getOpenAccountCountByPhone(String phone);

    int ysMerchantInsert(Map<String, Object> ys_mct);

    int ysMerchantUpdate(Map<String, Object> ys_mct);
    @Select("select count(0) from ys_user_merchant where uid=#{uid}")
    int getUserMerchantCount(String uid);

    @Select("select count(0) from user_id_card_mobao where uid=#{uid}")
    int getUserIdCordCount(String uid);

    int userIdCordUpdate(Map<String, Object> ys_mct);

    int userIdCordInsert(Map<String, Object> ys_mct);
    @Update("update user_wx set phone=#{phone} where id = #{uid} ")
    int updatePhone(@Param("uid") String uid, @Param("phone")String phone);

    @Select("select * from user_id_card_mobao where uid=#{uid}")
    Map<String, Object> getUserIdCord(String uid);

    @Update("update user_wx set alipayUid=#{alipayUid},alipayName = #{alipayName},update_time=NOW() where id=#{id}")
    int updateAliByUser(LoginInfo loginInfo);

    @Select("SELECT COUNT(0) FROM  user_bank WHERE user_id = #{userId}")
    int getUserBankCount(String id);

    @Update("update user_wx set realIdCardUp=#{realIdCardUp} where id = #{uid} ")
    int realIdCardUp(@Param("uid")String uid, @Param("uid")int realIdCardUp);

    int withdrawRecordStatus(@Param("uid")long uid, @Param("status")int status);

    int userWithdrawBlackInsert(@Param("uid")long uid, @Param("createTime")long createTime);

    List<Map<String,Object>> userLogout();

    @Select("SELECT COUNT(0) FROM  user_wx WHERE nickName = #{nickName}")
    int getNickNameInfo(String nickName);
}
